package com.hhss.eurekaclient.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Auther: zcc
 * @Date: 19-9-30 09:17
 * @Description:
 */
@RestController
public class TestController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("hello")
    public String testMethod(@RequestParam String name) {
        System.out.println("hello " + name + "!");
        return "hello";
    }

    @GetMapping("ribbon-test")
    public String testRestTemplate(String name){
        return restTemplate.getForObject("http://eureka-client/hello?name="+name, String.class);
    }
}
